<?php
/* 
* @Author: Jerry-chen
* @Date:   2014-07-11 16:04:41
* @Last Modified time: 2014-07-25 08:59:54
* @Last Modified by: Jerry-chen<uranusbill@163.com>
* @ Copyright (c) 2014 http://www.cooldreamer.com All rightsreserved.
*/

class GoodsModel extends Model
{
	//指定表
	public $table = 'goods';
	/**
	 * [add 插入数据]
	 */
	public function add_($data=null)
	{
		$result = $this->add($data);
		//返回增加的主键ID
		return $result;
	}
	/**
	 * [get_all 获是所有数据]
	 * @param  [type] $where [description]
	 * @return [type]        [description]
	 */
	public function get_all($where=null,$id=null,$field=null){

		return $this->where($where)->order($id)->field($field)->all();
	}
	/**
	 * [get_one 取得一个数据]
	 * @return [type] [description]
	 */
	public function get_one($where=null,$field=null)
	{
		return $this->where($where)->field($field)->find();
	}
	/**
	 * [del_ 删除数据]
	 * @return [type] [description]
	 */
	public function del_($where)
	{
		return $this->where($where)->del();
	}
	/**
	 * [get_in in方法]
	 * @return [type] [description]
	 */
	public function get_in($in=null,$id=null,$field=null,$limit=null)
	{
		return $this->in($in)->order($id)->field($field)->limit($limit)->get_all();
	}
	/**
	 * [Search 搜索]
	 */
	public function search($where=null,$field=null)
	{
		return $this->where($where)->field($field)->all();
	}
}

